package cn.boysoft.core.log;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

import cn.boysoft.core.model.JSON;
import cn.boysoft.core.model.MessageTypeEnum;
import cn.boysoft.core.model.XML;
import cn.boysoft.core.util.JsonUtil;
import cn.boysoft.core.util.XmlUtil;

import com.fasterxml.jackson.annotation.JsonIgnore;
/**
 * @author 付厚俊
 * CreateTime 2013-4-4 下午5:22:47
 */
public class OperateLogEntity implements JSON,XML{
	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(length = 36)
	private String id;
	
	@Column(updatable = false)
	private Date createdTime = new Date();
	private String createdById;
	private String createdByName;
	private String keyword;
	@Transient
	private Object data;
	private MessageTypeEnum messageType;
	@JsonIgnore
	private String content;
	private String serviceName;
	private String serviceId;
	private long executeTime;
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public Date getCreatedTime() {
		return createdTime;
	}
	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}
	public String getCreatedById() {
		return createdById;
	}
	public void setCreatedById(String createdById) {
		this.createdById = createdById;
	}
	public String getCreatedByName() {
		return createdByName;
	}
	public void setCreatedByName(String createdByName) {
		this.createdByName = createdByName;
	}
	public String getKeyword() {
		return keyword;
	}
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getServiceName() {
		return serviceName;
	}
	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}
	public String getServiceId() {
		return serviceId;
	}
	public void setServiceId(String serviceId) {
		this.serviceId = serviceId;
	}
	public long getExecuteTime() {
		return executeTime;
	}
	public void setExecuteTime(long executeTime) {
		this.executeTime = executeTime;
	}
	
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	
	public MessageTypeEnum getMessageType() {
		return messageType;
	}
	public void setMessageType(MessageTypeEnum messageType) {
		this.messageType = messageType;
	}
	@Override
	public String toJson() {
		return JsonUtil.toJson(this);
	}
	@Override
	public String toXml() {
		return XmlUtil.toXml(this);
	}
	
	
}
